#ifndef CCONFIG_H
#define CCONFIG_H

#include <string>
#include <map>
#include <fstream>

#define CONFIG_KEY_GRAPHICS_FULLSCREEN                              "gm_fullscreen"
#define CONFIG_KEY_GRAPHICS_WINDOW_WIDTH                            "gm_window_width"
#define CONFIG_KEY_GRAPHICS_WINDOW_HEIGHT                           "gm_window_height"
#define CONFIG_KEY_GRAPHICS_VSYNC                                   "gm_vsync"


class CConfig
{
private:
    std::string m_FileName;
    std::map<std::string, std::string> m_Config;
    std::fstream m_Write;

    CConfig(const CConfig& other);
    CConfig& operator=(const CConfig& other);

protected:
public:
    CConfig();
    virtual ~CConfig();

    bool Read();
    int GetInt(const std::string& key, int def);
    std::string GetString(const std::string& key, const std::string& def);
    void WriteValue(const std::string& key, int value);
    void WriteValue(const std::string& key, const std::string& value);
    bool StartWrite();
    void EndWrite();

    // Setter Functions

    void SetFileName(const std::string& fileName)                   { m_FileName = fileName; }
};

#endif // CCONFIG_H
